home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.sprintlink.net!news1!ts02-and-07
- From: dlmiller@iquest.net (Doug & Rose Miller)
- Subject: Re: Help !!!!! on 'strstr"
- X-Nntp-Posting-Host: ts02-and-07.iquest.net
- Message-ID: <DoE30t.G5u@iquest.net>
- Sender: news@iquest.net (News Admin)
- Organization: IQuest Network Services
- X-Newsreader: News Xpress Version 1.0 Beta #2.1
- References: <314703FF.4045@msmail.st.stems.com>
- Date: Sun, 17 Mar 1996 01:57:39 GMT
-
- kim hai <Kim_Hai.Ng@msmail.st.stems.com> wrote:
- +Help !!!!!
- +
- +Problem :
- + I need to locate a string within another string, and the process
- +must be case insensitive. As far as I know, strstr() only locates the
- +exact match and is case sensitive.
- + Does anyone konw of any functions that could allow me to locate
- +substrings and is case insensitive ?
- +
- +Eg.
- +case 1:
- + string1 = "abc"
- + string2 = "abcdef"
- +case 2:
- + string2 = "Abcdef"
- +case 3:
- + string3 = "aBcdef"
- +case 4:
- + string4 = "abCdef"
- +.....
- +....
- +...
- +
- +Is taking care of all the combinations ( = 8) in string1 the only
- +solution ? I'm working on Unix platform.
- +
- +Thankx
- +
- +<hai>
- +
- Use strupr() on both strings -- to insure they are both the same case -- before using strstr().
- Of course, strlwr() would work also.
-
- Perhaps you should copy both strings to temporary areas and use strupr() on the temps,
- because it does not merely return the case-shifted string, it actually case-shifts the original.
-
-